import React from 'react';
import { List, Typography, Button } from 'antd';
import { putEvents } from '../api/event';
const EventList = ({ edata, title, flag, Toggle }) => {
  return (
    <List
      style={{ width: '50vw', margin: '20px 20px 0px 40px' }}
      header={<div>{title}</div>}
      bordered
      dataSource={edata.filter((item) => item.event_status == flag)}
      renderItem={(item, index) => {
        return (
          <List.Item>
            <p
              style={{
                lineHight: '20px',
                display: 'inline-block',
                whiteSpace: 'nowrap',
                width: '750px',
                overflow: 'hidden',
                textOverflow: 'ellipsis',
              }}
            >
              {item.event_descri}
            </p>
            <Button
              type="primary"
              danger
              onClick={() => {
                Toggle(2 - flag, item.event_id, index);
              }}
            >
              {flag == 0 ? '确认' : '撤销确认'}
            </Button>
          </List.Item>
        );
      }}
    />
  );
};

export default EventList;
